package com.neko.Thread_Learning;


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class t21_ThreadPool {
    public static void main(String[] args) {

        // 1、创建服务，创建线程池
        ExecutorService executorService = Executors.newFixedThreadPool(10);

        executorService.execute(new MyThread());
        executorService.execute(new MyThread());
        executorService.execute(new MyThread());
        executorService.execute(new MyThread());

        // 2、关闭 线程池连接
        executorService.shutdown();

    }
}

class MyThread implements Runnable {
    @Override
    public void run() {

        System.out.println(Thread.currentThread().getName());

    }
}